/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package forms;

import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;
import model.SendMail;

/**
 *
 * @author root
 */
@ManagedBean(name = "contactus")
@RequestScoped
public class ContactUs implements  Serializable{
    
    private String name;
    private String email;
    private String message ;
    private String title;
    private int submitted=0;    // zerro mean not submitted 

    public int getSubmitted() {
        return submitted;
    }

    public void setSubmitted(int submitted) {
        this.submitted = submitted;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    
    
    
    
    public String sendContact()
    {
        System.out.println(" name is : "+name+" email is : "+email+" description : "+message);
        String formattedMessage="Sender Name "+name+"Sender Email: "+email+"\n Message Title : "+title +" \n Message :  " +message;
        new SendMail().send("info@kateba.net", name,formattedMessage , email);
        submitted=1;
        name="";
        message="";
        title="";
        email="";
                
        return "contactUs";
    }
    
    
}
